import type { FC, ReactNode, CSSProperties } from "react";

export type SelfDefinedItemType<ItemType extends BaseItemType> =
  | ItemType
  | {
      label: string;
      value: DescriptionDefaultValueType;
      labelTips?: ReactNode;
    };

export type ItemComponent<V = any, M = any> = FC<{
  value: V;
  meta: M;
}>;

export type BaseItemType = {
  type?: string;
  label: string;
  value?: any;
  meta?: any;
  labelTips?: ReactNode;
};

export type DescriptionDefaultValueType =
  | string
  | number
  | boolean
  | null
  | undefined;

export interface DescriptionProps<T> {
  items?: Array<T>;
  bordered?: boolean;
  columns?: 1 | 2 | 3;
  columnGap?: number;
  title?: ReactNode;
  style?: CSSProperties;
  labelWidth?: number;
  namespace?: symbol;
  onEdit?: () => void; // 编辑
  emptyValueText?: ReactNode;
}
